Skip to content

fix: preserve thought_signature on tool call parts for Gemini 3#811

Merged
FL4TLiN3 merged 4 commits intomainfrom
fix/google-thought-signature
Mar 15, 2026
Merged

fix: preserve thought_signature on tool call parts for Gemini 3#811
FL4TLiN3 merged 4 commits intomainfrom
fix/google-thought-signature

Conversation

@FL4TLiN3
Copy link
Contributor

Summary

Follow-up to #809. The previous fix handled thought_signature on reasoning parts, but Gemini 3 also requires thought_signature on functionCall parts in the conversation history. This was the actual root cause.

  • Add providerMetadata field to ToolCallPart schema to store provider-specific metadata (e.g., Google's thoughtSignature)
  • Preserve providerMetadata from AI SDK tool call results when building tool call parts
  • Pass providerMetadata as providerOptions when converting back to AI SDK messages

Test plan

  • bun run typecheck passes (24/24)
  • bun run test passes (all packages)
  • Needs manual verification with Gemini 3 models after Docker image rebuild

🤖 Generated with Claude Code

FL4TLiN3 and others added 3 commits March 15, 2026 20:15
The thinking signature was only preserved for Anthropic's namespace,
causing Gemini 3 models to fail with "Function call is missing a
thought_signature" on the second turn of tool-calling conversations.

- Extract signature from google.thoughtSignature and vertex.thoughtSignature
- Store signatureProvider to restore the correct namespace on output
- Add tests for Google and Vertex signature extraction

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The previous fix only handled thought_signature on reasoning parts,
but Gemini 3 also requires thought_signature on functionCall parts
in the conversation history. This was the actual root cause of the
"Function call is missing a thought_signature" error.

- Add providerMetadata field to ToolCallPart schema
- Preserve providerMetadata from AI SDK tool call results
- Pass providerMetadata as providerOptions when converting back to AI SDK messages

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@FL4TLiN3 FL4TLiN3 enabled auto-merge (squash) March 15, 2026 22:40
@FL4TLiN3 FL4TLiN3 merged commit 92ff964 into main Mar 15, 2026
11 checks passed
@FL4TLiN3 FL4TLiN3 deleted the fix/google-thought-signature branch March 15, 2026 22:44
@FL4TLiN3 FL4TLiN3 mentioned this pull request Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant